<template>
  <common_print_dialog ref="common_print_dialog" singlePrintNumber :templateVisiable="false" :templateRequire="false"
  businessType="OUTBOUND_WAYBILL" v-bind="$attrs" v-on="$listeners" :tableModel="tableModel" :printUrl="printUrl"
    :printHandler="printHandler" :previewUrl="previewUrl" :previewHandler="previewHandler" :urlGetFun="urlGetFun" />
</template>

<script>
import common_print_dialog from './common_print_dialog.vue'

export default {
  components: { common_print_dialog },
  props: {

  },
  data() {
    return {
      previewUrl: "/wms-api/outbound/OutboundOverseasOrderRpc/previewExceptionWaybill.json",
      printUrl: "/wms-api/outbound/OutboundOverseasOrderRpc/printExceptionWaybill.json",
      tableModel:[
      { key: 'trackNumber', label: 'label_track_or_package_code', 'min-width': 120, 'show-overflow-tooltip': true, },

      ]
    }
  },
  methods: {
    urlGetFun(row) {
      if (this.threeTrack) {
        return { url: row.labelOssPath, oss: true }
      } else {
        return null
      }
    },
    previewHandler(data, row) {
      data.trackNumber = row.trackNumber;
      data.platformCode = row.platformCode
      data.printerName = 'none'
      data.clientName = 'none'
      return data
    },
    printHandler(data, list) {
      data.printTrackNumberList = list.map(it => (
          {
            trackNumber: it.trackNumber,
            platformCode: it.platformCode,
            printNum: it.printNum,
          }
        ))
      return data
    },
    show(rows) {
      this.$refs.common_print_dialog.show(rows, {
        title:this.$tt('label_print_any', { type: this.$t('label_abnormal_face_track') }),
      })
    },
  }
}
</script>
